package cn.fanqinghong.ymcc.doc;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

/**
 * FAN
 * 2022/7/24  11:30
 */
@Document(indexName = "course",type = "_doc")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseDoc {

    @Id
    private Long id;

    //课程名字要分词
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    //等级搜索，不分词
    @Field(type = FieldType.Keyword)
    private String gradeName;

    @Field(type = FieldType.Keyword)
    private String forUser;//适用人群

    @Field(type = FieldType.Keyword)
    private String courseTypeName;//课程分类名称

    @Field(type = FieldType.Keyword)
    private String pic;//封面

    @Field(type = FieldType.Integer)
    private Integer totalMinute;//时长

    @Field(type = FieldType.Date)
    private Date onlineTime;//上架时间

    @Field(type = FieldType.Keyword)
    private String chargeName;//是否收费

    @Field(type = FieldType.Double)
    private BigDecimal price;//价格

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String intro;//简介

    @Field(type = FieldType.Integer)
    private Integer commentCount;//评论数

    @Field(type = FieldType.Integer)
    private Integer viewCount;//浏览量

    @Field(type = FieldType.Integer)
    private Integer saleCount;//销量

    @Field(type = FieldType.Double)
    private BigDecimal priceOld;//原价
}
